Another alternative in this case is to declare name to be a character pointer variable rather than an array. Then it may be assigned the address of a constant array direct- ly or immobile space allocated dynamically with the standard malloc() function*:
void Person::set(void)
{
name = "Jack Knapp"; /* no problem with TC. OR use... */
name = malloc((sizeof char) * 80); /* another approach: dynamic allocation */
strcpy(name,"Jack Knapp"); /* no problem if name is allocated dynamically */
}
Another circumstance where the handle implementation causes difficulties is when using the standard fread() and fwrite() functions for binary file I/O. The following syntax is needed in this case. (A type name given in parentheses is a CAST**.)
HLock(object); /* Mac Toolbox routine to prevent memory moving */